package gdou.gym.vo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


public class Ask4SpaceVo {

    private Integer status;
    private String applicant;
    private Date begin;
    private Date end;

    @Override
    public String toString() {
        return "Ask4SpaceVo{" +
                "status=" + status +
                ", applicant='" + applicant + '\'' +
                ", begin=" + begin +
                ", end=" + end +
                '}';
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {

        this.status = status;
    }

    public String getApplicant() {
        return applicant;
    }

    public void setApplicant(String applicant) {

        this.applicant = applicant;
    }

    public Date getBegin() {
        return begin;
    }

    public void setBegin(String begin) {
        if (begin == null) return;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            this.begin = sdf.parse(begin);
        } catch (ParseException e) {
            this.begin = null;
        }
    }

    public void setBegin(Date begin) {

        this.begin = begin;
    }


    public Date getEnd() {
        return end;
    }

    public void setEnd(String end) {
        if (end == null) return;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            this.end = sdf.parse(end);
        } catch (ParseException | NullPointerException e) {
            this.end = null;
        }
    }

    public void setEnd(Date end) {
        this.end = end;
    }
}

